using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class sport_planMap : EntityTypeConfiguration<sport_plan>
    {
        public sport_planMap()
        {
            // Primary Key
            this.HasKey(t => t.sport_plan_id);

            // Properties
            // Table & Column Mappings
            this.ToTable("sport_plan");
            this.Property(t => t.sport_plan_id).HasColumnName("sport_plan_id");
            this.Property(t => t.sport_menu_seq).HasColumnName("sport_menu_seq");
            this.Property(t => t.sport_menu_id).HasColumnName("sport_menu_id");
            this.Property(t => t.intervention_plan_id).HasColumnName("intervention_plan_id");
            this.Property(t => t.start_time).HasColumnName("start_time");
            this.Property(t => t.end_time).HasColumnName("end_time");
            this.Property(t => t.target).HasColumnName("target");

            // Relationships
            this.HasOptional(t => t.intervention_plan)
                .WithMany(t => t.sport_plan)
                .HasForeignKey(d => d.intervention_plan_id);
            this.HasOptional(t => t.sport_menu)
                .WithMany(t => t.sport_plan)
                .HasForeignKey(d => d.sport_menu_id);

        }
    }
}
